﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MovieRental.Entities;
using MovieRental.BuisnessComponents;

namespace MovieRental.EnhancedEntities
{
    public class Loan : BaseEnhancedEntity<LoanInfo>
    {
        public Loan(LoanInfo loan) : base(loan)
        {
        }

        public string MovieTitle
        {
            get
            {
                var edition = ComponentFactory.Instance.GetEditionComponent().Get(Entity.EditionId);
                return ComponentFactory.Instance.GetMovieComponent().Get(edition.MovieId).Title;
            }
        }

        public string Publisher
        {
            get { return ComponentFactory.Instance.GetEditionComponent().Get(Entity.EditionId).Publisher; }
        }

        public string MediaTypeName
        {
            get
            {
                var edition = ComponentFactory.Instance.GetEditionComponent().Get(Entity.EditionId);
                return ComponentFactory.Instance.GetMediaTypeComponent().Get(edition.MediaTypeId).Name;
            }
        }
        
    }
}
